

import time
import threading
import thread
import gtk

class SimStepper(threading.Thread):
	stopthread = threading.Event()
	functions = []
	
	def run(self):
		while not self.stopthread.isSet():
			gtk.gdk.threads_enter()
			for fun in self.functions:
				fun()
			#	#if not fun():
			#		#gtk.gdk.threads_leave()
			#		#self.stop()
			
			gtk.gdk.threads_leave()
			time.sleep(0.03)
	
	def stop(self):
		self.stopthread.set()

